import {
    postMethod,
    getMethod
} from './axios.js'

export default {
    login(data) {
        return postMethod('/api/admin/login', data)
    },
    statue() {
        return getMethod('/api/admin/statue', {})
    },
    createTag(tagName) {
        return postMethod('/api/admin/tag/add', {
            tagName: tagName
        })

    },
    createType(tagId, typeName) {
        return postMethod('/api/admin/type/add', {
            tagId: tagId,
            typeName: typeName
        })
    },
    editTag(tagId, tagName) {
        return postMethod('/api/admin/tag/update', {
            tagId: tagId,
            tagName: tagName
        })
    },
    editType(tagId, typeId, typeName) {
        return postMethod('/api/admin/type/update', {
            tagId: tagId,
            typeId: typeId,
            typeName: typeName
        })
    },
    editNoteText(noteid, text) {
        return postMethod('/api/admin/note/edit', {
            noteId: noteid,
            note: text
        })
    },
    editNoteTitle(noteid, title) {
        return postMethod('/api/admin/note/edit', {
            noteId: noteid,
            noteName: title
        })
    },
    editComment(commentId, text) {
        return postMethod('/api/admin/comment/edit', {
            commentId: commentId,
            text: text
        })
    },
    deleteTag(tagId) {
        return postMethod('/api/admin/tag/delete', {
            tagId: tagId
        })
    },
    deleteType(typeId) {
        return postMethod('/api/admin/type/delete', {
            typeId: typeId
        })
    },
    deleteNote(noteId) {
        return postMethod('/api/admin/note/delete', {
            noteId: noteId
        })
    },
    deleteComment(commentId) {
        return postMethod('/api/admin/comment/delete', {
            commentId: commentId
        })
    },
    noteGood(noteId, good) {
        return postMethod('/api/admin/note/setGood', {
            noteId: noteId,
            isGood: !good ? 1 : 0
        })
    },
    noteLight(noteId, color) {
        return postMethod('/api/admin/note/setLight', {
            noteId: noteId,
            tittleColor: color
        })
    },
    noteTop(noteId, top) {
        return postMethod('/api/admin/note/setTop', {
            noteId: noteId,
            top: !top ? 1 : 0
        })
    }
}